package com.itfitness.calendarview

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.databinding.DataBindingUtil
import com.itfitness.calendarview.databinding.ActivityMainBinding
import com.itfitness.calendarview.widget.CalendarView

class MainActivity : AppCompatActivity() {
    private lateinit var mainBinding: ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mainBinding = DataBindingUtil.setContentView(this,R.layout.activity_main)
        mainBinding.lifecycleOwner = this
        mainBinding.calendarView.onPageChangedCallBack = object :CalendarView.OnPageChangedCallBack{
            override fun onPageChanged(year: Int, month: Int) {
                Log.e("当前页的年月","${year}年${month}月")
            }
        }
        mainBinding.calendarView.onDateSelectCallBack = object :CalendarView.OnDateSelectCallBack{
            override fun onDateSelect(year: Int, month: Int, day: Int) {
                mainBinding.tvShowDate.text = "${year}年${month}月${day}日"
            }
        }

    }
}